package com.smartticket.jeju.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.smartticket.jeju.model.Sight;
import com.smartticket.jeju.model.Ticket;
import com.smartticket.jeju.service.TicketService;

@Controller

public class MainController {
	
	@RequestMapping(value="/", method=RequestMethod.GET)
	public String home() {
		return "redirect:/main";
	}
	
	@Autowired
	private TicketService ticketService;
	
	@RequestMapping("/main")
	public ModelAndView main(){
		ModelAndView modelAndView = new ModelAndView();
		//
		//head.jsp
		
		//body.jsp
		
		//mainContents.jsp
		List<Ticket> tickets = ticketService.list();
		modelAndView.addObject("tickets", tickets);
		
		//loginContents.jsp
		//footer.jsp
		
		return modelAndView;
	}
}
